#ifndef __DELAYLIST_H__
#define __DELAYLIST_H__

#include "const.h"
#include "type.h"
#include "proc.h"

typedef struct delay_node_s {
    PROCESS* proc;
    u32 lock;
    int delay;

    struct delay_node_s* next;
}delay_t;

typedef struct delaylist{
    delay_t* head;
    u32 lock;
    int size;
    int capacity;
}delaylist;


// 初始化节点
void init_delay_node(delay_t* node, PROCESS* proc);
// 初始化队列
void init_delaylist(delaylist* dlist, int capacity);

// 在延迟队列中插入
int insert_delay_node(delaylist* dlist, delay_t* node);
// 在延迟队列中删除
int remove_delay_node(delaylist* dlist, delay_t* node);


// 打印延迟队列
void print_delay_list(delaylist* dlist);


// 延迟队列整体延迟减 1 tick
void minus_delay(delaylist* dlist);

#endif 